import { login } from '../api/login'
import { userStore } from '../store/index.js'

const store = userStore()
const handleLogin = (data) => {
  return new Promise((resolve, reject) => {
    login(data).then(res => {
      if (res.success) {
        store.setLoginUser(res.data)
        resolve(res)
      }
    })
  })
}

export {
  handleLogin
}
